<% 
	import os 
	import urllib	
%>

${h.javascript_tag(h.update_element_function("arrow1",action='empty'))}
${h.javascript_tag(h.update_element_function("arrow2",action='empty'))}
${h.javascript_tag(h.update_element_function("count",action='empty'))}

% if session['pager'].has_prev():
	${h.javascript_tag(h.update_element_function("arrow1",position='bottom', content=h.submit_to_remote('prev', 'Previous', url=h.url_for(action="prev"), update='results')))}
% else:
	${h.javascript_tag(h.update_element_function("arrow1",position='bottom', content="<input type='button' value='Previous' disabled='true'/>"))}
% endif

% if session['pager'].has_next():
	${h.javascript_tag(h.update_element_function("arrow2",position='bottom', content=h.submit_to_remote('next', 'Next', url=h.url_for(action="next"), update='results')))} 
% else:
	${h.javascript_tag(h.update_element_function("arrow2",position='bottom', content="<input type='button' value='Next' disabled='true'/>"))}
% endif

<table width="100%" border="0" cellspacing="8" cellpadding="5">

<% i = 0 %>

% if session['pager'].has_page():

	<tr>
	
	<% page = session['pager'].page() %>
	
	% for hit in page:
	
		<tr>
		<td valign="top" align="left" width="32" height="32">
		
				
				<img src="${h.url_for(action="icon", uri=hit.get_uri(),index=str(i))}"/>
		</td>
		<td>
				
				<% 
				title = hit.get_properties('dc:title')
				if title is None:
					title = urllib.unquote(hit.get_uri())
				else:
					title = urllib.unquote(title[0])
				%>
				
				% if hit.get_uri().startswith("file://"):
					
					% if session.has_key('openwith') and session['openwith'] == "app":
						
						${h.link_to_remote("<b>" + title + "</b>", dict(url=h.url_for(action='open_here', uri=hit.get_uri())))} 
					% else:
						<a href="${h.url_for(action="open", uri=hit.get_uri(),index=str(i))}"><b>${title}</b></a>
					% endif


					

				% else:
					<a href="${hit.get_uri()}">${title}</a>

				% endif
		
				
				
				<br>
				<div id="detail${i}">
					<font size="-1">
						${urllib.unquote(hit.get_uri())}
						${h.link_to_remote('more', dict(update="detail" + str(i), url=h.url_for(action='detail', index=str(i), show='more')))} 
					</font>
				</div>
					
		</td>
		</tr>
		
		<% i = i + 1 %>
		
	% endfor

% endif

</table>


${h.javascript_tag(h.update_element_function("count",position='bottom', content="<p>Showing %s to %s of %s hits</p>" % (session['pager'].curindex + 1, session['pager'].curindex + i,session['pager'].endindex)    ))}